import { ReactNode } from 'react'

// table列
export interface columnsProps {
  title: string | ReactNode
  dataIndex: string
  width?: number | null
  sorter?: boolean
  editable?: boolean
  render?: any
  textWrap?: string
  ellipsis?: boolean | object // ant属性，控制单元格内容自动省略，showTitle: false,时需手动增加Tooltip
  fixed?: true | 'left' | 'right'
  className?: string
  columnType?: string // 用来指定字段类型，好做格式转换
  key?: number | string
}

// 左侧选择框
export interface rowSelectionProps {
  selectedRowKeys: string[] | number[]
  fixed?: boolean
  selectedRows?: any[] | undefined
  onChange?: (selectedRowKeys: string[] | number[], selectedRows: any[]) => void
  onSelect?: (record: any, selected: boolean, selectedRows: Object[], nativeEvent: Event) => void
  onSelectAll?: (selected: boolean, selectedRows: any[], changeRows: any[]) => void
  hideDefaultSelections?: boolean
  columnWidth?: string | number
}

export interface TableGridProps {
  className?: string
  tableInfo: {
    tableRef?: any
    tableData: any
    tableColumns: columnsProps[] // table列
    getUniqueKey: Function // 唯一id,按照ant标准传入
    tableIsLoading?: boolean
    getTableChangeValues?: Function // 获取table事件
    rowSelection?: rowSelectionProps
    scrollHeight?: string // 高度需要外部传入，一般为容器高度减去搜索区域和分页区域
    scrollWidth?: string | number // 宽度可以比column的总宽度大10px，每个column的宽度可设置为内容需要的最小宽度
  }
  emptyComponent?: ReactNode
}
